<template>
  <div>
    <Child v-if="visible" />
    <p>
      <button @click="toggle">
        切换child组件显示隐藏
      </button>
    </p>
  </div>
</template>


<script setup lang="ts">
  import { ref, provide } from "vue"
  import Child from "./components/Child.vue"

  const visible = ref(true)
  const timer = ref(null)
  const count = ref(0)
  provide("timer", timer)
  provide("count", count)

  function toggle() {
    visible.value = !visible.value
  }
</script>

<style></style>